package br.enovar.com;

import org.hibernate.Session;

public class DAO<T> {
	
	private Class persistentClass;
	protected Session session;
	
	
	
	public Session getSession() {
		return session;
	}

	public void setSession(Session session) {
		this.session = session;
	}

	public DAO(Session session, Class persistentClass){
		this.session = session;
		this.persistentClass = persistentClass;
	}
	
	public T load(Long id){
		return (T) session.load(persistentClass, id);
	}
	
	public void save(T t){
		session.save(t);
	}
	
	public void delete(T t){
		session.delete(t);
	}
	
	public void update(T t){
		session.update(t);
	}
	
}
